﻿using MySqlConnector;

namespace Front._1120;

public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();
    }

    private void 测试数据库连接_Click(object sender, EventArgs e)
    {
        using var connection = new MySqlConnection("server=localhost;port=3306;database=book;user=root;password=123456;charset=utf8mb4;AllowPublicKeyRetrieval=True");
        connection.Open();

        using var command = new MySqlCommand("SELECT * FROM admin_info;", connection);
        using var reader = command.ExecuteReader();
        while (reader.Read())
            Console.WriteLine(reader.GetInt32(0));
    }
}